504225544 by Unknown
Author:Unknown
Language: eng
Format: epub
The function calculate_age is called once; it returns the calculated age, and this (returned) value is saved in the variable called
This variable my_age is then printed in the Output
Now that you have written the code for your new function, please do the following:
Save your code.
Check that there are no errors in the Output window and play the scene.
The console should display, amongst other things, the message âYour age is
As you can see, there are different types of methods that you can create, depending on your needs. They may or may not take parameters, and they may or may not return values.
Note that we could have specified the type of the data to be returned by the function by modifying its definition as follows (new cold in bold):
func calculate_age(YOB:int)->int:
var age:int = 2021-YOB
return (age)
We could also have specified a default value for the parameter DOB as follows (new cold in bold):
func calculate_age(YOB:int = 2000)->int:
var age:int = 2021-YOB
return (age)
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Kathy Andrews Collection by Kathy Andrews(10544)
The remains of the day by Kazuo Ishiguro(7572)
Spare by Prince Harry The Duke of Sussex(4217)
Paper Towns by Green John(4175)
The Body: A Guide for Occupants by Bill Bryson(3813)
Be in a Treehouse by Pete Nelson(3231)
Harry Potter and the Goblet Of Fire by J.K. Rowling(3066)
Goodbye Paradise(2973)
Never by Ken Follett(2905)
Into Thin Air by Jon Krakauer(2711)
The Remains of the Day by Kazuo Ishiguro(2626)
The Genius of Japanese Carpentry by Azby Brown(2613)
The Cellar by Natasha Preston(2603)
Drawing Shortcuts: Developing Quick Drawing Skills Using Today's Technology by Leggitt Jim(2535)
120 Days of Sodom by Marquis de Sade(2444)
Architecture 101 by Nicole Bridge(2356)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(2309)
The Man Who Died Twice by Richard Osman(2305)
Industrial Automation from Scratch: A hands-on guide to using sensors, actuators, PLCs, HMIs, and SCADA to automate industrial processes by Olushola Akande(2112)